Change in openvpn[master]: event/multi: add event_arg object to make event handling more generic
A message that is not in the archive (sent off-list or not yet received): gerrit.1700055887000.If11e901c26fc5aafdcfd59a214d70c6e6a548f40@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/430?usp=email
to review the following change.
Change subject: event/multi: add event_arg object to make event handling more generic
......................................................................
event/multi: add event_arg object to make event handling more generic
In order to prepare the event handling code to deal with multiple listening sockets, we have to make sure that it is possible to distinguish which of these sockets have been pocked by an incoming connection request.
To achieve that, this patch changes the object being passed as event handler argument, from a "partly integer evaluated variable" to a full struct with a proper type attribute.
This struct will allow the code to carry around the particular listening socket where the connection is being established.
This change affects the TCP server code path only as UDP servers use only one socket to handle all clients i/o.
---
M src/openvpn/event.h
M src/openvpn/mtcp.c
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/socket.c
M src/openvpn/socket.h
6 files changed, 58 insertions(+), 13 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/30/430/1
src/openvpn/event.h +14 -0
@@ -126,6 +126,20 @@struct event_set_functions func; }; +typedef enum { +EVENT_ARG_MULTI_INSTANCE =0 , +EVENT_ARG_LINK_SOCKET , +}event_arg_t ; + +/* generic event argument object to pass to event_ctl() */ +struct event_arg +{ +event_arg_t type; +union { +struct multi_instance *mi;/* if type = EVENT_ARG_MULTI_INSTANCE */ + } u; +}; +/* * maxevents on input: desired max number of event_t descriptors * simultaneously set with event_ctl
src/openvpn/mtcp.c +36 -13
71 lines not on this page · raw message
src/openvpn/multi.c +3 -0
@@ -823,6 +823,9 @@ goto err; } + mi->ev_arg.type =EVENT_ARG_MULTI_INSTANCE ; + mi->ev_arg.u.mi = mi; +perf_pop ();gc_free (&gc);return mi;
src/openvpn/multi.h +1 -0
@@ -102,6 +102,7 @@struct schedule_entry se;/* this must be the first element of the structure, * We cast between this and schedule_entry so the * beginning of the struct must be identical */ +struct event_arg ev_arg;struct gc_arena gc;bool halt;int refcount;
src/openvpn/socket.c +2 -0
@@ -1827,6 +1827,8 @@ ALLOC_OBJ_CLEAR(sock, struct link_socket); sock->sd =SOCKET_UNDEFINED ; sock->ctrl_sd =SOCKET_UNDEFINED ; + sock->ev_arg.type =EVENT_ARG_LINK_SOCKET ; +return sock; }
src/openvpn/socket.h +2 -0
@@ -166,6 +166,8 @@ {struct link_socket_info info; +struct event_arg ev_arg; +socket_descriptor_t sd;socket_descriptor_t ctrl_sd;/* only used for UDP over Socks */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/430?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If11e901c26fc5aafdcfd59a214d70c6e6a548f40
Gerrit-Change-Number: 430
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
ordex has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/430?usp=email )
Change subject: event/multi: add event_arg object to make event handling more generic
......................................................................
Abandoned
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/430?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If11e901c26fc5aafdcfd59a214d70c6e6a548f40
Gerrit-Change-Number: 430
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon
ordex has restored this change. ( http://gerrit.openvpn.net/c/openvpn/+/430?usp=email )
Change subject: event/multi: add event_arg object to make event handling more generic
......................................................................
Restored
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/430?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If11e901c26fc5aafdcfd59a214d70c6e6a548f40
Gerrit-Change-Number: 430
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: restore
ordex has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/430?usp=email )
Change subject: event/multi: add event_arg object to make event handling more generic
......................................................................
Abandoned
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/430?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If11e901c26fc5aafdcfd59a214d70c6e6a548f40
Gerrit-Change-Number: 430
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon